package org.jingle.sketch
{
	import flash.display.Graphics;
	import flash.display.Loader;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.net.URLRequest;
	
	public class GraphicsUtils
	{
		public function GraphicsUtils()
		{
		}

		public static function drawLine(g:Graphics, x1:int, y1:int, x2:int, y2:int):void
		{
			g.moveTo(x1,y1);
            g.lineTo(x2,y2);
		}
		
		public static function loadImage(path:String, action:Function, object:Object):void {
			var loader:Loader = new Loader();
	        var request:URLRequest = new URLRequest(path);
	        
		    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function():void{
		        action.call(object, loader);
		    });
	        loader.load(request);
		}
	}
}